import java.util.StringTokenizer;



class ICPCP3651_7752 {

	public static void main(String[] args) {
		
		while (true) {
			StringTokenizer st = new StringTokenizer(readLn());
			int n = Integer.parseInt(st.nextToken());
			int c = Integer.parseInt(st.nextToken());
			int k = Integer.parseInt(st.nextToken());
			
			if (n == 0 && c == 0 && k == 0) break;
			
			process(n, c, k);
		}
		
	}
	
	private static void process(int n, int c, int k) {
		int[] numbers = new int[k + 1];
		
		for (int i = 0; i < n; i++) {
			
			StringTokenizer st = new StringTokenizer(readLn());
			
			for (int j = 0; j < c; j++) {
				int index = Integer.parseInt(st.nextToken());
				numbers[index]++;
			}
			
		}
		
		int minValue = Integer.MAX_VALUE;
		
		for (int i = 1; i < k + 1; i++) {
			if (numbers[i] < minValue) 
				minValue = numbers[i];
		}
		
		StringBuffer sb = new StringBuffer();
		for (int i = 1; i < k + 1; i++) {
			if (minValue == numbers[i])
				sb.append(i + " ");
		}
		
		System.out.println(sb.toString().trim());
		
	}

	static String readLn() {
        String newLine = System.getProperty("line.separator");
        StringBuffer buffer = new StringBuffer();
        int car = -1;
        try {
            car = System.in.read();
            while ((car > 0) && (car != newLine.charAt(0))) {
                buffer.append((char)car);
                car = System.in.read();
            }
            if (car == newLine.charAt(0))
            System.in.skip(newLine.length() - 1);
        } catch (java.io.IOException e) { return (null);}
        if ((car < 0) && (buffer.length() == 0)) return (null);
        return (buffer.toString()).trim();
    }
	
}
